(function(){

'use strict';

/**
 * @ngdoc function
 * @name sasAppApp.controller:TimeDataDisCtrl
 * @description
 * # TimeDataDisCtrl
 * Controller of the sasAppApp
 */
angular.module('controllers.timeDataDis', [
  'controllers.timeDataDis.health',
  'controllers.timeDataDis.sysPerformance',
  'controllers.timeDataDis.totalTransaction',
  'controllers.timeDataDis.successRate',
  'controllers.timeDataDis.volumeOfBus',
  'controllers.timeDataDis.splitTime',
  'controllers.timeDataDis.topUpPrefer',
  'controllers.timeDataDis.provinceSuccessRateOfTrans',
  'controllers.timeDataDis.provinceVolumeOfBus'
])
  .controller('TimeDataDisCtrl', function ($scope, socketServer) {

    //控制器销毁时，注销所有socket监听
    $scope.$on("$destroy", function () {
      socketServer.socket.removeAllListeners();
    });

    //当前TAB
    $scope.currentTab = 'provinceVolumeOfBus';

    //TAB状态 1为告警 2为正常
    $scope.tabState = {
      loding: true,
      volState: 2,
      rateState: 2
    };

    //切换TAB
    $scope.switchTabs = function (tab) {
      $scope.currentTab = tab;
    };

    $scope.currentShow = 0;//要显示的页面下标

    //左移
    $scope.arrowLeft = function (idx) {
      if ($scope.currentShow > 0) {
        $scope.currentShow--;
      } else {
        $scope.currentShow = idx;
      }
    };

    //右移
    $scope.arrowRight = function (idx) {
      if ($scope.currentShow < idx) {
        $scope.currentShow++;
      } else {
        $scope.currentShow = 0;
      }
    };

    //跳转
    $scope.setCurrentShow = function (index) {
      $scope.currentShow = index;
    };
  });

})();